package main

import(
	"github.com/17683954109/Tiny_GO/websocket"
)

func main()  {
	socket := websocket.NewWebSocket("WelCome To Go Socket Server !")
	socket.Handle(func(msg string, c *websocket.Conn) {
		if msg == "exit" {
			err := c.Close()
			if err != nil {
				panic(err)
			}
		}
		err := c.Write([]byte(msg + "\r\n"))
		if err != nil {
			panic(err)
		}
	})
	socket.Run(":8888")
}
